package com.vincent.pojo;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

/**
 * @author Vincent
 */
@Entity
@Table(name="user")
public class User implements java.io.Serializable {

	// Fields

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	@Id
	@GeneratedValue(strategy=GenerationType.AUTO)
	private Integer id;
	@Column(nullable=false,unique=true,length=10)
	private String userName;
	@Column(nullable=false,unique=false,length=50)
	private String pwd;
	@Column(nullable=false,unique=false,length=20)
	private String nickName;
	@Column(nullable=false,unique=true,length=100)
	private String email;
	@Column(nullable=false)
	@Temporal(TemporalType.TIMESTAMP)
	private Date alterDate;
	@Column(nullable=true,unique=false,length=100)
	private String icon;
	@Column(nullable=true,unique=false,length=1)
	private String gender;
	@OneToMany(mappedBy="user",cascade={CascadeType.ALL})
	private List<Credits> creditses = new ArrayList<Credits>();
	@OneToMany(mappedBy="user",cascade={CascadeType.ALL})
	private List<Posts> posts = new ArrayList<Posts>();
	@OneToMany(mappedBy="user",cascade={CascadeType.ALL})
	private List<Topic> topics = new ArrayList<Topic>();
	@OneToMany(mappedBy="user",cascade={CascadeType.ALL})
	private List<Subject> subjects = new ArrayList<Subject>();
	
	// Constructors

	/** default constructor */
	public User() {
	}


	// Property accessors

	public Integer getId() {
		return this.id;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	public String getPwd() {
		return this.pwd;
	}

	public void setPwd(String pwd) {
		this.pwd = pwd;
	}

	public String getNickName() {
		return this.nickName;
	}

	public void setNickName(String nickName) {
		this.nickName = nickName;
	}

	public String getEmail() {
		return this.email;
	}

	public void setEmail(String email) {
		this.email = email;
	}

	public String getIcon() {
		return this.icon;
	}

	public void setIcon(String icon) {
		this.icon = icon;
	}

	public String getGender() {
		return this.gender;
	}

	public void setGender(String gender) {
		this.gender = gender;
	}

	public List<Credits> getCreditses() {
		return this.creditses;
	}

	public void setCreditses(List<Credits> creditses) {
		this.creditses = creditses;
	}


	public Date getAlterDate() {
		return alterDate;
	}


	public void setAlterDate(Date alterDate) {
		this.alterDate = alterDate;
	}


	public List<Posts> getPosts() {
		return posts;
	}


	public void setPosts(List<Posts> posts) {
		this.posts = posts;
	}


	public List<Topic> getTopics() {
		return topics;
	}


	public void setTopics(List<Topic> topics) {
		this.topics = topics;
	}


	public List<Subject> getSubjects() {
		return subjects;
	}


	public void setSubjects(List<Subject> subjects) {
		this.subjects = subjects;
	}


	public String getUserName() {
		return userName;
	}


	public void setUserName(String userName) {
		this.userName = userName;
	}

}